package com.artwork.service.impl;

import com.artwork.mapper.AddressMapper;
import com.artwork.model.Address;
import com.artwork.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author JoJo
 * @Data 2021/9/8$ 16:29$
 * @Description
 * @Param $
 * @Return $
 */
@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    AddressMapper addressMapper;


    @Override
    public List<Address> getMyAddress(int userId) {
        return addressMapper.getMyAddress(userId);
    }

    @Override
    public int newAddress(Address address) {
        return addressMapper.insertSelective(address);
    }

    @Override
    public int updateAddressType(int id ,Integer type) {
        return addressMapper.updateAddressType(id, type);
    }

    @Override
    public int updateAddressType(Address address) {
        return addressMapper.updateByPrimaryKeySelective(address);
    }

    @Override
    public Address getAddressById(int id) {
        return addressMapper.selectByPrimaryKey(id);
    }

    @Override
    public int delete(int id) {
        return addressMapper.delete(id);
    }
}
